<template>
  <div class='application-container'>
      <!-- <MainLayout/>
      <BlankLayout/> -->
      <!-- 动态组件 -->
      <component :is="layoutName"/>
  </div>
</template>

<script>
export default {
  watch: {
      menus(val) {
          let menuList = val.filter(it => !!it.path)
          let routes = menuList.map(it => {
              return {path: it.path, component: (() => import('.' + it.path))}
          })
          this.$router.addRoutes(routes)
      }
  },
  computed: {
      layoutName() {
          return this.$route.meta.layout || 'MainLayout'
      },
      menus() {
          return this.$store.getters['common/menuList']
      }
  }
}
</script>